﻿@model Web
@{
    ViewBag.Title = Html.Global("Install_CreateWeb_CreateTopSite");
    Layout = "~/Views/Shared/_ClearnLayout.cshtml";
}
@{var context = WebSiteContext.Current;}
@section NavSection
{
    <div style="display: block;">
        <ul id="sequence">
            <li><span>1</span>@Html.Global("RES_PREPARING")</li>
            <li>&gt;</li>
            <li><span>2 </span>@Html.Global("Install_Setup_AdminAccount")</li>
            <li>&gt;</li>
            <li class="d-current"><a href="#"><span>3 </span>@Html.Global("Install_Setup_TopSite")</a></li>
        </ul>
    </div>
}
@if (context.RootWeb == null)
{
    using (Html.BeginForm())
    {
    <section>
        <header class="d-section">
            <span>@Html.Global("Install_Common_Settings")</span><hr />
        </header>
        <table class="d-field-table">
            <tr>
                <td>
                    <h3 class="d-field-title">
                        @Html.Global("RES_OWNER")</h3>
                </td>
                <td>@ViewBag.Owner
                    <input type="hidden" name="Web.Owner" value="@ViewBag.Owner" />
                </td>
            </tr>
            <tr>
                <td>
                    <h3 class="d-field-title">
                        <label for="Web_Title">
                            @Html.Global("language", "RES_TITLE")
                        </label>
                    </h3>
                    <div class="d-field-description">
                        @Html.Global("RES_WEBSITE_TITLE_TIPS")
                    </div>
                </td>
                <td>
                    @Ajax.DnaFor().TextBox(m => m.Title).Width(300).GetHtml()
                </td>
            </tr>
            <tr>
                <td>
                    <h3 class="d-field-title">
                        @Html.Global("RES_THEME")
                    </h3>
                    <div class="d-field-description">
                    </div>
                </td>
                <td>
                    @(Ajax.Dna().ComboBox("Web.Theme")
                    .Bind(WebSiteContext.Current.DataContext.Themes.All().Select(p => p.Name).ToArray())
                    .Select("default")
                    .DropDownList()
                    .GetHtml())
                </td>
            </tr>
            <tr>
                <td>
                    <h3 class="d-field-title">
                        <label for="Web_Description">
                            @Html.Global("RES_DESC")</label></h3>
                    <div class="d-field-description">
                        @Html.Global("RES_WEBSITE_DESC_TIPS")
                    </div>
                </td>
                <td>
                    @Ajax.DnaFor().TextArea(m => m.Description).Width(300).Resizable().GetHtml()
                </td>
            </tr>
        </table>
    </section>
    <section>
        <header class="d-section">
            <span>@Html.Global("Install_CreateWeb_SelectTemplate")</span><hr />
        </header>
        <table style="margin-top: 5px;">
            <tr>
                <td style="width: 200px;">
                    @(
 Ajax.Dna().ListBox("solution")
  .Items(items =>
        {
            var pkgs = WebSiteContext.Current.DataContext.Solutions.All();
            foreach (var pkg in pkgs)
            {
                items.Add(new NavigableData()
                {
                    Title = pkg.Title,
                    ToolTip = pkg.Description,
                    Value = pkg.Name,
                });
            }
        })
        .Options(opts =>
        {
            opts.OnItemSelected = "$(\"#pkgDetail\").html($(ui.item).children(\".d-hidden\").html())";
        })
        .ItemTemplate(@<text> <span>@GE.GetContent(item.Title)</span>
                    <div style="display: none;" class="d-hidden">
                        @(MvcHtmlString.Create(GE.GetContent(item.Description)))
                    </div>
                    </text>)
                    .Select("Core")
                    .GetHtml()
   )
                </td>
                <td id="pkgDetail" style="vertical-align: top; padding-left: 5px;">
                    The core template only install the DotNetAge core ( including personal web site,
                    publising application plugin and community application plugin) but do not initizial
                    any data.You must customize the pages,features and content by manual.
                </td>
            </tr>
        </table>
    </section>
    <hr />
    <ul class="d-horizontal-list" style="padding: 10px; text-align: right;">
        <li>@Ajax.Dna().Link(Html.Global("RES_HELP"), Url.Help(11), Url.Content("~/content/images/help.png")).Options(opts => { opts.Target = "_blank"; }).GetHtml()</li>
        <li>
            @Ajax.Dna().Button().LocText("RES_PREVIOUS").ImageIcons(Url.Content("~/content/images/icon_back_16.png")).Click("location=\"" + Url.Action("Account") + "\";").GetHtml()</li>
        <li>@Ajax.Dna().Button().Submit().LocText("RES_INSTALL").GetHtml()</li>
    </ul>
    }
}